home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / ingres04.lzh / source / iutil / do_u_flag.c < prev    next >
Encoding:
C/C++ Source or Header  |  1985-01-23  |  865 b   |  48 lines

  1. # include    <ingres.h>
  2. # include    <aux.h>
  3. # include    <sccs.h>
  4.  
  5. SCCSID(@(#)do_u_flag.c    8.1    12/31/84)
  6.  
  7. /*
  8. **  DO_U_FLAG -- Get User Code from User Code or Name
  9. **
  10. **    This routine is the "-u" flag processing.
  11. **
  12. **    Parameters:
  13. **        u_flag -- a pointer to the -u flag.
  14. **
  15. **    Returns:
  16. **        zero -- user not found (message also printed).
  17. **        else -- pointer to the user code for the override user.
  18. **
  19. **    Side Effects:
  20. **        The actual text of the -u flag may be trashed with the
  21. **            new user code.
  22. */
  23.  
  24. char *
  25. do_u_flag(u_flag)
  26. char    *u_flag;
  27. {
  28.     register char    *p;
  29.     char        buf[MAXLINE + 1];
  30.  
  31.     p = u_flag;
  32.  
  33.     if (getnuser(&p[2], buf) != 0)
  34.     {
  35.         if (p[2] == 0 || p[3] == 0 || p[4] != 0 ||
  36.             getuser(&p[2], buf) != 0)
  37.         {
  38.             getuser(0);
  39.             printf("User %s does not exist\n", &p[2]);
  40.             return (0);
  41.         }
  42.         getuser(0);
  43.         return (&p[2]);
  44.     }
  45.     smove(getufield(buf, 1), p);
  46.     return (p);
  47. }
  48.